package com.vsen.lpr.service;

import com.google.api.client.util.Lists;
import com.vsen.lpr.common.exception.BusinessException;
import com.vsen.lpr.common.model.Response;
import com.vsen.lpr.common.utils.BeanCopyUtil;
import com.vsen.lpr.common.utils.MinioTemplate;
import com.vsen.lpr.entity.Balance;
import com.vsen.lpr.entity.Banner;
import com.vsen.lpr.mapper.BalanceMapper;
import com.vsen.lpr.mapper.BannerMapper;
import com.vsen.lpr.pojo.dto.BalanceDto;
import com.vsen.lpr.pojo.dto.BannerDto;
import com.vsen.lpr.pojo.dto.InsertBannerDto;
import com.vsen.lpr.pojo.vo.BalanceVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 服务类
 * </p>
 *
 * @author yy
 * @since 2021-09-01
 */
@Service
public class BalanceService {

    @Autowired
    private BalanceMapper balanceMapper;

    public Response<BalanceVo> balanceInfo(BalanceDto dto) {
        Balance balance = balanceMapper.selectByUserId(dto.getUserId());
        if (balance == null) {
            throw new BusinessException("500002", "用户账户不存在");
        }
        BalanceVo balanceVo = new BalanceVo();
        balanceVo.setBalance(balance.getBalance());
        return Response.success(balanceVo);
    }
}
